//
//  YHConstant.m
//  ScriptKill
//
//  Created by lin on 2020/6/22.
//  Copyright © 2020 ScriptKill. All rights reserved.
//

#import "YHConstant.h"

void YHLog(NSString *format, ...) {
#ifdef DEBUG
//    printf("%s\n",__FUNCTION__);
    printf("\n");
    va_list argptr;
    va_start(argptr, format);
    NSLogv(format, argptr);
    va_end(argptr);
#endif
}



BOOL YHIsIPad(void){
    return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
}


static CGFloat yh_tatio = 0;
CGFloat Adapted(CGFloat value){
    
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat height = [UIScreen mainScreen].bounds.size.height;
    
    if (yh_tatio==0) {
        if(YHIsIPad()){
            yh_tatio = (width>height?height:width)/768.0;//9.7
        }else{
            yh_tatio = (width>height?height:width)/375.0;//4.7
        }
    }
    CGFloat v = ceilf(yh_tatio*value);
    v = MAX(v, value);
    return v;
}
static CGFloat yh_tatio_height = 0;
CGFloat AdaptedHeight(CGFloat value){
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat height = [UIScreen mainScreen].bounds.size.height;
    
    if (yh_tatio_height==0) {
        if(YHIsIPad()){
            yh_tatio_height = (width>height?width:height)/1024.0;//9.7
        }else{
            yh_tatio_height = (width>height?width:height)/667.0;//4.7
        }
    }
    CGFloat v = ceilf(yh_tatio_height*value);
    v = MAX(v, value);
    return v;
}




#pragma mark - notifition

/// 登录信息 Token过期
NSNotificationName YHLoginTokenExpireNotifition = @"YHLoginTokenExpireNotifition";


@implementation YHConstant

@end
